package de.fhaugsburg.games.boardgames.scrabble;

import de.fhaugsburg.games.boardgames.Board;
import de.fhaugsburg.games.boardgames.Square;
/**
 * A ScrabbleBoard is needed for a Scrabble game, the board has several different details on its squares, called ScrabbleSquareDetails. The
 * piece which are used in scrabble are LetterPieces.
 * @author r4smus
 *
 */
public class ScrabbleBoard extends Board<LetterPiece, ScrabbleSquareDetails> {

	public ScrabbleBoard() {
		squares = new Square[15][15]; //standard size of a scrabble board

		for (int row = 0; row < getHeight(); row++) {
			for (int column = 0; column < getWidth(); column++) {
				squares[row][column] = new Square<LetterPiece, ScrabbleSquareDetails>();
				setDetails(new ScrabbleSquareDetails(SquareMultiplier.LETTERMULT_1), row, column);
			}
		}
	setBoardDetails();
		
		
	}
/**
 * sets all details for the squares, if you want a shorter implementation of the method you can improve it with a symmetry algorithm. ;)	
 */
	private void setBoardDetails(){
		//set all letterMultis2
		ScrabbleSquareDetails letterMulti2 = new ScrabbleSquareDetails(SquareMultiplier.LETTERMULTI_2);
		setDetails(letterMulti2, 0, 3);
		setDetails(letterMulti2, 0, 11);
		setDetails(letterMulti2, 2, 6 );
		setDetails(letterMulti2, 2, 8 );
		setDetails(letterMulti2, 3, 0);
		setDetails(letterMulti2, 3, 7);
		setDetails(letterMulti2, 3, 14);
		setDetails(letterMulti2, 6, 2);
		setDetails(letterMulti2, 6, 6);
		setDetails(letterMulti2, 6, 8);
		setDetails(letterMulti2, 6, 12);
		setDetails(letterMulti2, 7, 3);
		setDetails(letterMulti2, 7, 11);
		setDetails(letterMulti2, 8, 2);
		setDetails(letterMulti2, 8, 6);
		setDetails(letterMulti2, 8, 8);
		setDetails(letterMulti2, 8, 12);
		setDetails(letterMulti2, 11, 0);
		setDetails(letterMulti2, 11, 7);
		setDetails(letterMulti2, 11, 14);
		setDetails(letterMulti2, 12, 6);
		setDetails(letterMulti2, 12, 8);
		setDetails(letterMulti2, 14, 3);
		setDetails(letterMulti2, 14, 11);
		
		//set all letterMultis3
		ScrabbleSquareDetails letterMulti3 = new ScrabbleSquareDetails(SquareMultiplier.LETTERMULTI_3);
		setDetails(letterMulti3, 1, 5);
		setDetails(letterMulti3, 1, 9);
		setDetails(letterMulti3, 5, 1);
		setDetails(letterMulti3, 5, 5);
		setDetails(letterMulti3, 5, 9);
		setDetails(letterMulti3, 5, 13);
		setDetails(letterMulti3, 9, 1);
		setDetails(letterMulti3, 9, 5);
		setDetails(letterMulti3, 9, 9);
		setDetails(letterMulti3, 9, 13);
		setDetails(letterMulti3, 13, 5);
		setDetails(letterMulti3, 13, 9);
		
		//set all wordMultis2
		ScrabbleSquareDetails wordMulti2 = new ScrabbleSquareDetails(SquareMultiplier.WORDMULTI_2);
		setDetails(wordMulti2, 1, 1);
		setDetails(wordMulti2, 1, 13);
		setDetails(wordMulti2, 2, 2);
		setDetails(wordMulti2, 2, 12);
		setDetails(wordMulti2, 3, 3);
		setDetails(wordMulti2, 3, 11);
		setDetails(wordMulti2, 4, 4);
		setDetails(wordMulti2, 4, 10);
		setDetails(wordMulti2, 10, 4);
		setDetails(wordMulti2, 10, 10);
		setDetails(wordMulti2, 11, 3);
		setDetails(wordMulti2, 11, 11);
		setDetails(wordMulti2, 12, 2);
		setDetails(wordMulti2, 12, 12);
		setDetails(wordMulti2, 13, 1);
		setDetails(wordMulti2, 13, 13);
		
		//set all wordMultis3
		ScrabbleSquareDetails wordMulti3 = new ScrabbleSquareDetails(SquareMultiplier.WORDMULTI_3);
		setDetails(wordMulti3, 0, 0);
		setDetails(wordMulti3, 0, 7);
		setDetails(wordMulti3, 0, 14);
		setDetails(wordMulti3, 7, 0);
		setDetails(wordMulti3, 7, 14);
		setDetails(wordMulti3, 14, 0);
		setDetails(wordMulti3, 14, 7);
		setDetails(wordMulti3, 14, 14);
		
		
	}

}
